<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>选择报表</title>
    <link rel="stylesheet" href="/css/vivo.css">
    <link rel="stylesheet" href="/vivo/layui/css/layui.css">

    <style type="text/css">
    .w{
        width: 1280px;
        margin: 15px auto;
    }
    </style>

</head>

<body class="layui-layout-admin">
<div class="w" >
    <ul id="breadcrumb">
        <li><a href="/"><span class="icon icon-home"><img src="/images/icons/64/home.png" width="28"/>  </span>返回</a>
        </li>
        <li></li>
    </ul>
    <table id="list" lay-filter="list"></table>
</div>
<script type="text/javascript" src="/js/jquery-1.11.1.min.js"></script>
<script src="/vivo/layui/layui.js"></script>
<script>
let table;
layui.use('table', function(){
  table = layui.table;

  //第一个实例
  table.render({
    elem: '#list'
    ,height: 'full-250'
    ,url: '/uc_report/list'
    ,page: true //开启分页
    ,limit: 25
    ,limits:[15,25,50,75,100]
    ,cols:
    [
        [
          {field: 'id',type:'numbers', title: '编号', width:80}
          ,{field: 'templateName', title: '报表名称'}
          ,{field: 'opt', title: '操作',align:'center' ,
               templet: function(d){
                    let h = '<a class="layui-btn layui-btn-normal layui-btn-xs" href="/report/showReport/'+d.id+'">查看报表</a> '
                        +' <a class="layui-btn layui-btn-xs" href="/report/edit/'+d.id+'">编辑</a>'
                        +' <a class="layui-btn layui-btn-danger layui-btn-xs" onclick="del(\''+d.id+'\')">删除</a>';
                    return h;
                }
            }
        ]
    ]
  });
});
function del(id,gridName){
    var url="/uc_report/delete";
    layer.confirm("您确定删除此报表模板吗？", {icon: 3}, function(index){
        $.get(url,{id:id},function(data){
            if(data.success){
                layer.alert(data.msg, {icon: 6});
                reloadTable();
            }else{
                layer.alert(data.msg,{icon:4});
            }
        })
    });
}
function reloadTable(){
	table.reload('list', {
		  page: {
		    curr: 1 //重新从第 1 页开始
		  }
		});
}
</script>


</body>
</html>
